#include "mainwinwidget.h"
#include <QApplication>
#include "fonts/fontmanager.h"

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
    QApplication a(argc, argv);
    FontManager fontManager;

    QString fontFamily = fontManager.loadFont(":/wqy-microhei.ttc");
    if (fontFamily.isEmpty()) {
        qCritical() << "Failed to load font, fallback to system default.";
    } else {
        // 使用加载的字体家族名称设置全局字体
        if (!fontManager.setGlobalFont(fontFamily, 14)) {
            qCritical() << "Failed to set global font.";
        }
    }

    MainWinWidget w;
    w.setWindowTitle("温湿度监控采集");
    w.setGeometry(0,0,1024,600);
    w.show();
    return a.exec();
}
